package com.yiqi.liebang.common.widget;

import android.content.Context;
import android.net.Uri;
import android.view.View;
import android.widget.TextView;

import com.suozhang.framework.utils.T;
import com.umeng.socialize.ShareAction;
import com.yiqi.liebang.R;
import com.yiqi.liebang.common.util.RxClipboardTool;
import com.yiqi.liebang.common.widget.dialog.BottomBaseDialog;
import com.yiqi.liebang.common.widget.dialog.FlipVerticalSwingEnter;
import com.yiqi.liebang.entity.bo.UserCenterBo;

public class ShareBottomDialog extends BottomBaseDialog<ShareBottomDialog> {

    TextView mBtnShareDialogLiebang;
    TextView mBtnShareDialogCircle;
    TextView mBtnShareDialogWx;
    TextView mBtnShareDialogQq;
    TextView mBtnShareDialogSina;
    TextView mBtnShareDialogLink;
    TextView mBtnShareDialogCancle;

    TextView mBtnShare;
    UserCenterBo mData;
    Context context;
    ShareAction share;
    View.OnClickListener wxCircleClickListener;
    View.OnClickListener wxClickListener;
    View.OnClickListener wxLBClickListener;


    boolean isInvited=false;
    public ShareBottomDialog(Context context, View animateView,boolean isInvited) {
        super(context, animateView);
        this.isInvited=isInvited;
        this.context=context;
    }


    public ShareBottomDialog(Context context, TextView mTvItem1, UserCenterBo mData) {
        super(context);
        this.mData=mData;
    }

    @Override
    public View onCreateView() {
        showAnim(new FlipVerticalSwingEnter());
        dismissAnim(null);
        View inflate = View.inflate(mContext, R.layout.dialog_share, null);
        mBtnShareDialogLiebang = inflate.findViewById(R.id.btn_share_dialog_liebang);
        mBtnShareDialogCircle = inflate.findViewById(R.id.btn_share_dialog_circle);
        mBtnShareDialogWx = inflate.findViewById(R.id.btn_share_dialog_wx);
        mBtnShareDialogQq = inflate.findViewById(R.id.btn_share_dialog_qq);
        mBtnShareDialogSina = inflate.findViewById(R.id.btn_share_dialog_sina);
        mBtnShareDialogLink = inflate.findViewById(R.id.btn_share_dialog_link);
        mBtnShareDialogCancle = inflate.findViewById(R.id.btn_share_dialog_cancle);
        mBtnShare = inflate.findViewById(R.id.tv_share);
        return inflate;
    }

    @Override
    public void setUiBeforShow() {

        if (isInvited){
            mBtnShare.setVisibility(View.GONE);
            mBtnShareDialogLiebang.setVisibility(View.GONE);

        }

        mBtnShareDialogLiebang.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        mBtnShareDialogCircle.setOnClickListener(wxCircleClickListener);
        mBtnShareDialogWx.setOnClickListener(wxClickListener);
        mBtnShareDialogQq.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        mBtnShareDialogSina.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        mBtnShareDialogLink.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                RxClipboardTool.copyUri(context, Uri.parse("http://liebangapp.com/yindao/"));
                T.showShort("已复制！");
            }
        });
        mBtnShareDialogCancle.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });

        mBtnShareDialogLiebang.setOnClickListener(wxLBClickListener);


    }

    public void setWxCircleClickListener(View.OnClickListener wxClickListener){
        this.wxCircleClickListener=wxClickListener;
    }
    public void setWxClickListener(View.OnClickListener wxClickListener){
        this.wxClickListener=wxClickListener;
    }

    public void setLBClickListener(View.OnClickListener wxLBClickListener){
        this.wxLBClickListener=wxLBClickListener;
    }

}